
/*
 * Copyright (C) 2008-2009 Archie L. Cobbs. All rights reserved.
 *
 * $Id: AbstractModel.java 315 2010-02-11 19:57:20Z archie.cobbs $
 */

package org.dellroad.sidekar.schema.model;

import java.util.Comparator;

/**
 * Common superclass for various schema model classes.
 */
public abstract class AbstractModel {

    /**
     * Sorts two {@link AbstractModel}s by name.
     */
    public static final Comparator<AbstractModel> NAME_COMPARATOR = new Comparator<AbstractModel>() {

        @Override
        public int compare(AbstractModel x, AbstractModel y) {
            return x.getName().compareTo(y.getName());
        }
    };

    private String name;

    // Normal constructor
    protected AbstractModel() {
    }

    // Copy constructor
    AbstractModel(AbstractModel original) {
        this.name = original.name;
    }

    public String getName() {
        return this.name;
    }
    public void setName(String name) {
        this.name = name;
    }
}

